package com.pig4cloud.pigx.shop.user.api.feign;

import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.shop.user.api.entity.ShopCoupon;
import com.pig4cloud.pigx.shop.user.api.entity.ShopUser;
import com.pig4cloud.pigx.shop.user.api.entity.ShopUserCoupon;
import com.pig4cloud.pigx.shop.user.api.vo.ShopEquityVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteShopCouponService", value = ServiceNameConstants.SHOP_USER_SERVICE)
public interface RemoteShopCouponService {

	/**
	 * 判断当前优惠券是否可用
	 * @param shopUserCoupon
	 * @param from
	 * @return
	 */
	// @GetMapping("/coupon/c/checkUserCouponStatue/{shopUserId}/{couponId}")
	@PostMapping("/coupon/c/checkUserCouponStatue")
	R checkUserCouponStatue(@RequestBody ShopUserCoupon shopUserCoupon,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 抵扣优惠券
	 * @param shopUserCoupon
	 * @return
	 */
	@PostMapping("/coupon/useUserCoupon")
	R useUserCoupon(@RequestBody ShopUserCoupon shopUserCoupon, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 根据优惠券ID获取优惠券详情
	 * @param couponId
	 * @param from
	 * @return
	 */
	@GetMapping("/coupon/getCouponInfoById/{couponId}")
	R<ShopCoupon> getCouponInfoById(@PathVariable(value = "couponId") Long couponId,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 根据用户领取的优惠券记录id获取优惠券信息
	 * @param shopUserCouponId
	 * @param from
	 * @return
	 */
	@GetMapping("/coupon/getCouponInfoByShopUserCouponId/{shopUserCouponId}")
	R<ShopCoupon> getCouponInfoByShopUserCouponId(@PathVariable(value = "shopUserCouponId") Long shopUserCouponId,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 判断权益包是否可以退款
	 * @param shopEquityVO
	 * @param from
	 * @return
	 */
	@PostMapping("/coupon/checkCancelEquityCoupons")
	R checkCancelEquityCoupons(@RequestBody ShopEquityVO shopEquityVO,
			@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 处理权益包退款，优惠券抵消
	 * @param shopEquityVO
	 * @param from
	 * @return
	 */
	@PostMapping("/coupon/cancelEquityCoupons")
	R cancelEquityCoupons(@RequestBody ShopEquityVO shopEquityVO, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 退回优惠券
	 * @param shopUserCouponId
	 * @param from
	 * @return
	 */
	@GetMapping("/coupon/returnShopUserCoupon/{shopUserCouponId}")
	R returnShopUserCoupon(@PathVariable(value = "shopUserCouponId") Long shopUserCouponId,
			@RequestHeader(SecurityConstants.FROM) String from);

}
